package com.firefly.dao.assembler.cms;

import com.firefly.dao.dao.cms.po.AdPosPo;
import com.firefly.dao.dto.cms.AdPosDto;
import com.firefly.dao.vo.cms.AdPosVo;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @description: 广告位类型转换
 * @author: lzg(萤火科技 ： 854378082 @ qq.com)
 * @date: 2022/12/18
 **/
@Component
public class AdPosAssembler {
    public List<AdPosVo> getVoList(List<AdPosPo> list){
        List<AdPosVo> result = new ArrayList<>();
        list.forEach(item -> {
            AdPosVo tmp = new AdPosVo();
            tmp.setId(item.getId());
            tmp.setName(item.getName());
            tmp.setIsMobile(item.getIsMobile());
            result.add(tmp);
        });
        return result;
    }

    public AdPosPo getPo(AdPosDto request){
        AdPosPo entity = new AdPosPo();
        entity.setId(request.getId());
        entity.setName(request.getName());
        entity.setIsMobile(request.getIsMobile());
        return entity;
    }

    public AdPosVo getVo(AdPosPo entity){
        AdPosVo detail = new AdPosVo();
        detail.setId(entity.getId());
        detail.setName(entity.getName());
        detail.setIsMobile(entity.getIsMobile());
        return detail;
    }
}
